//
//  TabBarViewController.m
//  Products_B
//
//  Created by lanou on 16/5/27.
//  Copyright © 2016年 朋学友. All rights reserved.
//

#import "TabBarViewController.h"
#import "MenuViewController.h"
#import "CommunityViewController.h"
#import "ShopViewController.h"
#import "CookClassViewController.h"
#import "MyViewController.h"
@interface TabBarViewController ()

@end

@implementation TabBarViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
//    第一个界面：食谱
    MenuViewController *menuVc = [[MenuViewController alloc]init];
    UINavigationController *menuNav = [[UINavigationController alloc]initWithRootViewController:menuVc];
    menuNav.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"食谱" image:[UIImage imageNamed:@"1.png"] selectedImage:[UIImage imageNamed:@"2.png"]];
    
//    第二个界面：社区
    CommunityViewController *communityVc = [[CommunityViewController alloc]init];
    UINavigationController *communityNav = [[UINavigationController alloc]initWithRootViewController:communityVc];
    communityNav.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"社区" image:[UIImage imageNamed:@"3.png"] selectedImage:[UIImage imageNamed:@"4.png"]];
//    第三界面：商城
    ShopViewController *shopVc = [[ShopViewController alloc]init];
    UINavigationController *shopNav = [[UINavigationController alloc]initWithRootViewController:shopVc];
    shopNav.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"商城" image:[UIImage imageNamed:@"5.png"] selectedImage:[UIImage imageNamed:@"6.png"]];
    
//    第四界面：食课
    CookClassViewController *cookVc = [[CookClassViewController alloc]init];
    UINavigationController *cookNav = [[UINavigationController alloc]initWithRootViewController:cookVc];
    cookNav.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"食课" image:[UIImage imageNamed:@"8.png"] selectedImage:[UIImage imageNamed:@"7.png"]];
    
//    第五界面：我的
    MyViewController *myVc = [[MyViewController alloc]init];
    UINavigationController *myNav = [[UINavigationController alloc]initWithRootViewController:myVc];
    myNav.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"我的" image:[UIImage imageNamed:@"9.png"] selectedImage:[UIImage imageNamed:@"10.png"]];
    
    self.viewControllers = @[menuNav,communityNav,shopNav,cookNav,myNav];
    
    self.selectedIndex = 0;
    
    // 设置选中状态下tabBar标题颜色 以及 图片颜色
    self.tabBar.tintColor = [UIColor orangeColor];
    // 设置所有导航栏上的文字颜色（标题除外）
     [[UINavigationBar appearance] setTintColor:[UIColor orangeColor]];
    // 改变文字大小
        [[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObject:[UIFont systemFontOfSize:15] forKey:NSFontAttributeName] forState:(UIControlStateNormal)];
    
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
